package com.ouyy.volunteerservice.volunteer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ouyy.volunteerservice.volunteer.domain.po.VolunteerRating;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface VolunteerRatingMapper extends BaseMapper<VolunteerRating> {

    @Select("SELECT volunteer_id, AVG(rating) AS avg_score FROM volunteer_rating GROUP BY volunteer_id")
    List<Map<String, Object>> getAvgScoresByVolunteerId();
}
